//
//  YKTestViewController.m
//  reSearchDemo
//
//  Created by 云库 on 15/9/15.
//  Copyright (c) 2015年 Kiwaro. All rights reserved.
//

#import "YKTestViewController.h"
#import "AFNetworking.h"
#import "BusinessClassInfo.h"
#import "BusinessClass.h"
#import "MJExtension.h"
#import "CityInfo.h"
#import "City.h"
#import "Business.h"
#import "BusinessInfo.h"
#import "BusinessNear.h"
#import "BusinessNearInfo.h"
#import "GoodsClass.h"
#import "GoodsClassInfo.h"
#import "GoodsSearch.h"
#import "GoodsRecommended.h"
#import "GoodsParam.h"
#import "Specval.h"
#import "GoodsOtherBuy.h"
#import "HTTPGlobals.h"


@interface YKTestViewController ()

@end

@implementation YKTestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.view.backgroundColor = [UIColor redColor];
    NSDictionary *dic = @{@"j_username":@"testaccount",@"j_password":@"testaccount",@"j_client":@"mobile"};
    DLog(@"dic = %@",dic);
    [[AFHTTPRequestOperationManager manager] POST:@"http://mall.yunku.mobi:8080/mall/j_spring_security_check" parameters:dic success:^(AFHTTPRequestOperation * opreation, id obj) {
        DLog(@"obj = %@",obj);
    } failure:^(AFHTTPRequestOperation * opreation, NSError * error) {
        DLog(@"error = %@",error);
    }];
    
    
    
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    
    NSString *str  = @"http://localhost:8080/mall/j_spring_security_check?j_username=testaccount&j_password=testaccount";
    str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    
    [manager GET:str parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        
        NSArray *array = [GoodsOtherBuy objectArrayWithKeyValuesArray:responseObject[@"data"]];
        GoodsOtherBuy *param = array[0];
        DLog(@"-----------%@",responseObject);
        
        
//        NSArray *array = [GoodsRecommended objectArrayWithKeyValuesArray:responseObject[@"data"]];
//        
//        
//        DLog(@"---%@",array[0]);
        
        
        
//      //  DLog(@"6666   %@",responseObject);
//        
//        NSArray *array = [GoodsSearch objectArrayWithKeyValuesArray:responseObject[@"data"]];
//        
//        GoodsSearch *goods = array[0];
//        DLog(@"=====%@",goods.goodName);
        
       // NSArray *info = [NSArray objectWithKeyValues:responseObject[@"data"]];
//        NSArray *classes = info.DATA;
//        GoodsClass *lc = classes[0];
//        DLog(@"===%@",lc.name);
        
        
//        CityInfo *info = [CityInfo objectWithKeyValues:responseObject];
//        NSArray *cities = info.data;
//        for (City *city in cities) {
//            DLog(@"===%@",city.name);
//        }
        
        
//        BusinessClassInfo *bus = [BusinessClassInfo objectWithKeyValues:responseObject];
//        NSArray *classes = bus.data;
//        BusinessClass *hello = classes[0];
//        DLog(@"===%d,%@",hello.type_id,hello.name);
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
}



- (void)refreshDataListIfNeed{
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
